Docker on FreeBSD with 1.7.0-dev
Docker Engine 1.7.0-dev with SVN last version
Last version of sysutils/docker-freebsd can't compile.
But you can run docker engine 1.7.0-dev with a patch below.
Get last version of sysutils/docker-freebsd via svn.
code:shell
A docker-freebsd/files
A docker-freebsd/Makefile
A docker-freebsd/distinfo
A docker-freebsd/files/docker.in
A docker-freebsd/files/patch-pkg_system_meminfo__unsupported.go
A docker-freebsd/files/patch-runconfig_config.go
A docker-freebsd/files/patch-runconfig_hostconfig.go
A docker-freebsd/pkg-descr
A docker-freebsd/pkg-message
Checked out revision 490308.
Apply patch below:
code:diff
--- pkg/archive/archive.go.orig 2020-12-22 07:46:00 UTC
+++ pkg/archive/archive.go
@@ -301,7 +301,7 @@ func createTarFile(path, extractDir string, hdr *tar.H
mode |= syscall.S_IFIFO
}
- if err := system.Mknod(path, mode, int(system.Mkdev(hdr.Devmajor, hdr.Devminor))); err != nil {
+ if err := system.Mknod(path, mode, uint64(system.Mkdev(hdr.Devmajor, hdr.Devminor))); err != nil {
return err
}
--- pkg/system/mknod.go.orig 2015-06-08 13:34:30 UTC
+++ pkg/system/mknod.go
@@ -8,7 +8,7 @@ import (
// Mknod creates a filesystem node (file, device special file or named pipe) named path
// with attributes specified by mode and dev
-func Mknod(path string, mode uint32, dev int) error {
+func Mknod(path string, mode uint32, dev uint64) error {
return syscall.Mknod(path, mode, dev)
}
You can install:
code:shell
$ cd docker-freebsd/
$ sudo make install
(snip)
For runnning docker engine, you must set up at /etc/rc.conf.
code:/etc/rc.conf
# Docker
docker_enable="YES"
docker_dir=/docker
You must create docker engine workspace using ZFS.
code:shell
% sudo zfs create -o mountpoint=/docker zroot/docker
Run docker engine.
code:shell
% sudo service docker start
You can get docker version:
code:shell
$ docker version
Client version: 1.7.0-dev
Client API version: 1.19
Go version (client): go1.15.6
Git commit (client): 582db78
OS/Arch (client): freebsd/amd64
Server version: 1.7.0-dev
Server API version: 1.19
Go version (server): go1.15.6
Git commit (server): 582db78
OS/Arch (server): freebsd/amd64
And pull images.
code:shell
$ docker pull hello-world
latest: Pulling from hello-world
482c215f2373: Pull complete
fd74c3615f76: Pull complete
Digest: sha256:0ebe6f409b373c8baf39879fccee6cae5e718003ec3167ded7d54cb2b5da2946
Status: Downloaded newer image for hello-world:latest
You can run hello-world docker container image.
code:shell
$ docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
For more examples and ideas, visit:
Futhermore you can run ubuntu container.
code:shell
$ docker run ubuntu
Unable to find image 'ubuntu:latest' locally
latest: Pulling from ubuntu
1a8350c8f1ab: Pull complete
833936205d34: Pull complete
cefc2c955982: Pull complete
d6a22aa06b3a: Pull complete
7d5ba4fdfd37: Pull complete
Digest: sha256:0f077e58a161913d8d0804eebb2ea432e5322d90555a000d92b3df849ca26f5c
Status: Downloaded newer image for ubuntu:latest
$ docker run -it ubuntu bash
root@:/# ps
PID TTY TIME CMD
1084 pts/2 00:00:00 ps
1055 pts/2 00:00:00 bash
Problem: Can't run centos image
But centos can't run.
code:shell
$ docker run centos
Unable to find image 'centos:latest' locally
latest: Pulling from centos
9bd570a5383f: Extracting 8.913 MB/75.18 MB
1f260b789676: Download complete
49387ccacc22: Download complete
Pulling repository centos
Could not reach any registry endpoint
In this situation, docker engine output error message below:
code:shell
$ sudo /usr/local/bin/docker -d -e jail -s zfs -g /docker -D
(snip)
DEBU0055 zfs zfs destroy -r zroot/docker/9bd570a5383f3a7ddf7b5314cece481aec259cf45ae14913ce2c530442d5a3bc DEBU0055 zfs zfs create -o mountpoint=legacy zroot/docker/9bd570a5383f3a7ddf7b5314cece481aec259cf45ae14913ce2c530442d5a3bc DEBU0055 zfs zfs get -Hp all zroot/docker/9bd570a5383f3a7ddf7b5314cece481aec259cf45ae14913ce2c530442d5a3bc DEBU0055 zfs mount("zroot/docker/9bd570a5383f3a7ddf7b5314cece481aec259cf45ae14913ce2c530442d5a3bc", "/docker/zfs/graph/9bd570a5383f", "") DEBU0055 Start untar layer DEBU0056 zfs unmount("/docker/zfs/graph/9bd570a5383f") DEBU0056 zfs zfs destroy -r zroot/docker/9bd570a5383f3a7ddf7b5314cece481aec259cf45ae14913ce2c530442d5a3bc ERRO0056 Error from V2 registry: ApplyLayer exit status 1 stdout: stderr: platform and architecture is not supported DEBU0056 image does not exist on v2 registry, falling back to v1 DEBU0056 pulling v1 repository with local name "centos" DEBU0056 hostDir: /etc/docker/certs.d/index.docker.io DEBU0057 Retrieving the tag list DEBU0057 hostDir: /etc/docker/certs.d/registry-1.docker.io ERRO0058 unable to get remote tags: Could not reach any registry endpoint